package com.kai.xadmin.utils;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ResponseResult<T> {

	private Integer code;
	private String message;
	private T data;
	private Integer count;

	public static ResponseResult success() {
		return new ResponseResult(200, "操作成功", null, null);
	}

	public static ResponseResult success(Object data) {
		return new ResponseResult(200, "操作成功", data, null);
	}

	public static ResponseResult success(Object data, Integer count) {
		return new ResponseResult(200, "操作成功", data, count);
	}

	public static ResponseResult error() {
		return new ResponseResult(400, "操作失败", null, null);
	}

	public static ResponseResult error(String msg) {
		return new ResponseResult(400, msg, null, null);
	}
}
